package net.sky.oa.model;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.BatchSize;

/**
 * 相片表
 * TalPhoto. @author hond
 */
@Entity
@Table(name = "TAL_PHOTO")//相片表
@BatchSize(size=10)
public class TalPhoto implements java.io.Serializable {

	private static final long serialVersionUID = 5673991033245515351L;
	
	// Fields

	protected Long id;
	private String name;    //相片显示名称
	private Double picsize; //相片大小
	private String picurl;  //相片路径
	private Date createtime;//创建时间
	private String desn;    //相片说明
	private TalAlbum album;//相册分类id
	private SysEmployee user; //上传人
	private Integer type;      //类型：公共相片、个人相片

	// Constructors

	/** default constructor */
	public TalPhoto() {
	}
	
	public TalPhoto(Long id,String name,String picurl,String desn) {
       this.id=id;
       this.name=name;
       this.picurl=picurl;
       this.desn=desn;
	}
	@Id
    @Column(name = "ID", unique = true, nullable = false)
	@SequenceGenerator(name="SQ_TALPHOTO_ID",sequenceName="SQ_TALPHOTO_ID",allocationSize=1)
	@GeneratedValue(strategy=GenerationType.SEQUENCE,generator="SQ_TALPHOTO_ID")
	public Long getId() {
        return id;
    }

    public void setId(Long id){
    	this.id = id;
    }
	
	/** minimal constructor */
	public TalPhoto(Long id) {
		this.id = id;
	}

	@Column(name = "NAME", length = 40)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "PICSIZE", precision = 6)
	public Double getPicsize() {
		return this.picsize;
	}

	public void setPicsize(Double picsize) {
		this.picsize = picsize;
	}

	@Column(name = "PICURL", length = 100)
	public String getPicurl() {
		return this.picurl;
	}

	public void setPicurl(String picurl) {
		this.picurl = picurl;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "CREATETIME")
	public Date getCreatetime() {
		return this.createtime;
	}

	public void setCreatetime(Date createtime) {
		this.createtime = createtime;
	}

	@Column(name = "DESN", length = 100)
	public String getDesn() {
		return this.desn;
	}

	public void setDesn(String desn) {
		this.desn = desn;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "ALBUM_ID")
	public TalAlbum getAlbum() {
		return this.album;
	}

	public void setAlbum(TalAlbum album) {
		this.album = album;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "USER_ID")
	public SysEmployee getUser() {
		return this.user;
	}

	public void setUser(SysEmployee user) {
		this.user = user;
	}

	@Column(name = "TYPE", precision = 2, scale = 0)
	public Integer getType() {
		return this.type;
	}

	public void setType(Integer type) {
		this.type = type;
	}

}